package com.wk1un2.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wk1un2.dao.UsersDao;
import com.wk1un2.entity.Users;
import com.wk1un2.service.UsersService;
import com.wk1un2.util.Result;

@Service
public class UsersServiceImpl implements UsersService {
	@Autowired
	private UsersDao usersdao;

	@Override
	public List<Map<String, Object>> getAllUsers(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.getAllUsers(map);
	}

	@Override
	public Integer count(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.count(map);
	}

	@Override
	public Users getByUsersName(String name) {
		// TODO Auto-generated method stub
		return usersdao.getByUsersName(name);
	}

	@Override
	public Integer add(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.add(map);
	}

	@Override
	public Integer update(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.update(map);
	}

	@Override
	public Integer delete(Integer userid) {
		// TODO Auto-generated method stub
		return usersdao.delete(userid);
	}

	@Override
	public Result updateuserstate(Integer userid, Integer IsLockout) {
		// TODO Auto-generated method stub
		usersdao.updateuserstate(userid, IsLockout);
		return Result.ok(1);
	}

	@Override
	public Integer updatepassword(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.updatepassword(map);
	}

	@Override
	public Integer errorcount(Integer userid, Integer PsdWrongCount) {
		// TODO Auto-generated method stub
		return usersdao.errorcount(userid, PsdWrongCount);
	}

	@Override
	public Integer DoIsLock(Integer userid, Integer IsLockout) {
		// TODO Auto-generated method stub
		return usersdao.DoIsLock(userid, IsLockout);
	}

	@Override
	public List<Map<String, Object>> getAllBoxRoles(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.getAllBoxRoles(map);
	}

	@Override
	public List<Map<String, Object>> getAllBoxUserRoles(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.getAllBoxUserRoles(map);
	}

	@Override
	public Integer addBoxRoles(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return usersdao.addBoxRoles(map);
	}

	@Override
	public Integer deleteBoxRoles(Integer userid, Integer roleid) {
		// TODO Auto-generated method stub
		return usersdao.deleteBoxRoles(userid, roleid);
	}
	//查询用户姓名否重复存在
	@Override
	public Integer getUsersName(String username) {
		// TODO Auto-generated method stub
		return usersdao.getUsersName(username);
	}
	//查询用户是否分配过角色和当前用户不能删除
	@Override
	public Integer getUsersRole(Integer userid) {
		// TODO Auto-generated method stub
		return usersdao.getUsersRole(userid);
	}

}
